import { app } from "./common/index";

export async function upload(file, prefix){
  const cloudPath = prefix || file.name
  return app.uploadFile({
    // 云存储的路径
    cloudPath: cloudPath,
    // 需要上传的文件，File 类型
    filePath: file
  })
}

export async function deleteFile(files=[]) {
  files = [].concat(files)
  return app.deleteFile({
    fileList: files
  })
}

export async function downloadFile(fileId) {
  return app.downloadFile({
    fileID: fileId
  })
}

export async function templateUrl(files=[]) {
  files = [].concat(files)
  return app.getTempFileURL({
    fileList: files
  })
}